import 'package:flutter/services.dart';

class FilePicker {
  static const MethodChannel _channel = MethodChannel('file_uri_handler');

  /// 打开文件选择器并返回选中文件的路径
  static Future<String?> pickFile() async {
    try {
      final String? filePath = await _channel.invokeMethod(
        'handleOpeningStatement',
      );
      print('选择的文件路径为：$filePath');
      return filePath;
    } on PlatformException catch (e) {
      print('文件选择失败: ${e.message}');
      return null;
    } catch (e) {
      print('文件选择异常: $e');
      return null;
    }
  }
}
